package com.ming.zkcustom9003.controller;

import com.ming.zkcustom9003.mapper.TestMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.admin.KafkaAdminClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: tangC
 * @Date: 2020/6/29 14:07
 * @Description:
 */
@RestController
@Slf4j
public class TestController {

    @Value("${spring.datasource.name}")
    private String username;

    

    @Autowired
    private TestMapper testMapper;

    @Autowired
    private RedisTemplate redisTemplate;

    @GetMapping("test")
    public String test() {
        try {
            redisTemplate.opsForValue().get("cx");
        } catch (Exception e) {

        }
        return testMapper.test().toJSONString();
    }

    @GetMapping("test2")
    public String test2() {
        try {
            log.info("进入test2");
            Thread.sleep(900);
        } catch (Exception e) {

        }
        return username + "test2";
    }

    @GetMapping("test3")
    public String test3() throws Exception {
        log.info("进入test3");
        throw new RuntimeException();
    }

    public void kafkaTest(){

    }
}
